<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title>中心申投诉</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
<div class="box box-primary" id="more" style="width:110px;height:40px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <!-- <div class="box-header with-border">
                	更多操作
            </div> --><!-- /.box-header -->
            <div class="box-body home-message" id="moreOp">
            </div>
        </div>
    <section class="content-header">
        <h1>申投诉管理</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active">申投诉管理</li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                     <div class="form-group form-group-xs">
                        <label for="txtDrugName">申投诉标题：</label>
                        <input class="form-control" type="text" id="complainTitle" name="complainTitle" placeholder="申投诉标题" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">申投诉日期：</label>
                        <input class="form-control" type="text" id="complainDatetime" name="complainDatetime" data-provide="datepicker" data-date-fmt="yyyy-MM-dd" placeholder="yyyy-mm-dd" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label for="txtDrugForm">申投诉类型：</label>
                        <select id="complainType" class="form-control" name="complainType">
                        	<option value="">请选择</option>
                        	<option value="2">申诉</option>
                        	<option value="1">投诉</option>
                        </select>
                    </div>
                    <button type="button" onclick="gridSerch()" class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>

        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
	<form action="${ctx}/bidSubscribe/toCenterSubscribeJsp.html" method="post" id="Form">
	<input type="hidden" id="projId" name="projId">
	<input type="hidden" id="projName" name="projName">
	</form>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/sysComplain/getSysComplainDataList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit: false,
                height: 270,
                colNames: ['操作','申投诉id', '申投诉标题', '申投诉人','申投诉人所属机构','申投诉时间','申投诉类型','申投诉状态','处理人','处理时间','反馈人','反馈时间','更新人','更新时间'],
                colModel: [
                    { name: 'oper', width: 70, align: 'left' ,sortable: false,
	                    formatter:function (val, opts, rowdata) {
		                     if(rowdata.complainStatus == 2){
			                     return "<a href=\"javascript:detail('"+rowdata.complainId+"');\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='详情'></a>";
		                     }
		                if(rowdata.complainStatus == 1){
			                     return "<a href=\"javascript:detail('"+rowdata.complainId+"');\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='详情'></a><a href=\"javascript:handle('"+rowdata.complainId+"');\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -140px -40px' class='opIcon' title='处理'></a>";
		                     }
		                     if(1 != rowdata.complainStatus && 2 != rowdata.complainStatus ){
			                     return "<a href=\"javascript:detail('"+rowdata.complainId+"');\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='详情'></a>";
		                     }
	                        }
	                },
                    { name: 'complainId', key:true,hidden:true,width: 40, align: 'center' ,sortable: false},
                    { name: 'complainTitle', width: 100, align: 'center' ,sortable: false},
                    { name: 'prosonName', width: 100, align: 'center' ,sortable: false},
                    { name: 'compName', width: 190, align: 'center' ,sortable: false,
                    	formatter: function (val, opts, rowdata) {
                    		if(null != rowdata.prodcompName){
                    			return rowdata.prodcompName;
                    		}else
                    		if(null != rowdata.delcompName){
                    			return rowdata.delcompName;
                    		}else
                    		if(null != rowdata.hospName){
                    			return rowdata.hospName;
                    		}
                    	}
                    },
                    { name: 'complainDatetime', width: 140, align: 'center' ,sortable: false},
                    { name: 'complainType', width: 80, align: 'center' ,sortable: false,
						formatter: function (val, opts, rowdata) {
							if(1 == rowdata.complainType){
								return "投诉";
							}
							if(2 == rowdata.complainType){
								return "申诉";
							}
						}
					},
                    { name: 'complainStatus', width: 80,sortable: false, align:"center",
                    	formatter : function(val, opts, rowdata) {
                    		var str = "";
                    		if (rowdata.complainStatus == 1){
                			   str = "提交";
                    		} 
                    		if (rowdata.complainStatus == 2) {
                    			str = "已处理";
                    		}
                    		if(1 != rowdata.complainStatus && 2 != rowdata.complainStatus ){
                    			str = "新建";
                    		}
                    		return str;
                    	}	
                    },
					{ name: 'processUsername', width: 190, align: 'center' ,sortable: false},
					{ name: 'processDatetime', width: 140, align: 'center' ,sortable: false},
					{ name: 'feedbackUsername', width: 190, align: 'center' ,sortable: false},
					{ name: 'feedbackDatetime', width: 140, align: 'center' ,sortable: false},
					{ name: 'name', width: 190, align: 'center' ,hidden:true,sortable: false},
					{ name: 'updDatetime', width: 140, align: 'center' ,hidden:true,sortable: false}
					
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                multiselect: false, 
                caption: "申投诉列表",
                jsonReader: {
                    repeatitems: false  
                },
                loadComplete: function (data) { //完成服务器请求后，回调函数
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        //查询
        function gridSerch() {
        	var complainTitle = $("#complainTitle").val();
        	var complainDatetime = $("#complainDatetime").val();
        	var complainType = $("#complainType").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{
    	        		"complainTitle":complainTitle,
    	        		"complainDatetime":complainDatetime,
    	        		"complainType":complainType
    	        		}
    	    }).trigger("reloadGrid"); //重新载入  
    	}
      
		function detail(id){
			window.location.href="${ctx}/sysComplain/toSysComplaindetailJsp.html?complainId="+id;
		}
		
		function handle(id){
			window.location.href="${ctx}/sysComplain/toSysComplainHandleJsp.html?complainId="+id;
		}
    </script>
</body>
</html>